Bananas, Dark Worlds, and AspectH
نویسندگان
چکیده
This report summarises our idea of code clone detection in Haskell code and refactorings based on identified clones as it evolved in our group-of-three discussion. 1 Motivation Looking at the code example below, we observe a certain level of redundancy, in particular structural redundancy, such as pattern matching , if-then-elseconstructs, and recursion . addOdds :: Integral a => [a] -> a addOdds [] = 0 addOdds (h:t) = if odd h then h + (addOdds t) else addOdds t remNeg :: (Ord a, Num a) => [a] -> [a] remNeg [] = [] remNeg (h:t) = if h >= 0 then h : (remNeg t) else remNeg t getReflex :: Eq a => [(a,a)] -> [(a,a)] getReflex [] = [] getReflex ((x, y):t) = if (x == y) then (x, y) : (getReflex t) else getReflex t But how can we automate the process to find such recurring and somewhat redundant patterns? Should we investigate the source code directly, or is it better to find an intermediate representation, that abstracts the source code to a level where these patterns can be identified more easily, detached from the actual name of variables etc.? 1 Dagstuhl Seminar Proceedings 05451 Beyond Program Slicing http://drops.dagstuhl.de/opus/volltexte/2006/491 2 Functional Control Graph and Functional Control Tree As it would be very inconvenient to identify such redundancy by hand in the code, especially these structural similarities, we propose a special structure called functional control graph. Its entry node carries the name of the function, its other nodes each represent an expression from the Haskell code of that function. The edges can but may not necessarily be labeled: T (true)/F (false) for a step that requires the previous expression to be true/false, and parameter names in case any parameters are passed along. Considering the Haskell code example above, we get the following functional control graph for the function addOdds which takes a list of integers and returns the sum of all odd integers in that list:
منابع مشابه
AspectH: Uma Extensão Orientada a Aspectos de Haskel
This paper presents an extension of the Haskell programming language with the objective of improving modularization of functional programs. This extension, AspectH, extends Haskell with aspect oriented concepts. AspectH implements Aspect-Oriented Programming (AOP) through pointcuts and advice, like in AspectJ, and was designed to be used in Haskell programs that use monads.
متن کاملFluorescent chlorophyll catabolites in bananas light up blue halos of cell death.
Breakdown of chlorophyll is a major contributor to the diagnostic color changes in fall leaves, and in ripening apples and pears, where it commonly provides colorless, nonfluorescent tetrapyrroles. In contrast, in ripening bananas (Musa acuminata) chlorophylls fade to give unique fluorescent catabolites (FCCs), causing yellow bananas to glow blue, when observed under UV light. Here, we demonstr...
متن کاملWhy the Monkey Needs the Box: A Serious Look at a Toy Domain
“Toy worlds” involving actions, such as the Blocks World and the Monkey and Bananas domain, are often used by researchers in the areas of commonsense reasoning and planning to illustrate and test their ideas. Many of the axioms found in descriptions of these toy worlds are expressions of generalpurpose knowledge, though they are often cast in a form only useful for solving one specific problem ...
متن کاملp-Adic and Adelic Cosmology: p-Adic Origin of Dark Energy and Dark Matter
A brief review of p-adic and adelic cosmology is presented. In particular, p-adic and adelic aspects of gravity, classical cosmology, quantum mechanics, quantum cosmology and the wave function of the universe are considered. p-Adic worlds made of p-adic matters, which are different from real world of ordinary matter, are introduced. Real world and p-adic worlds make the universe as a whole. p-A...
متن کاملFood from Earth: Sustainable Farming in Action
The banana is the world's largest herbaceous flowering plant. Commercial bananas are sterile and are propagated by planting root stock from donor plants (the dark specks in the center of a banana are undeveloped ovules, the precursors to seeds).
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2006